<div class="speedbar">
    <div class="speedbar-content">
        <ul class="menu-speedbar">
            <li>
                <a href="<?php echo Yii::app()->createUrl('admin/settings/admin'); ?>" class="act_link">
                    Cập nhật cài đặt 
                </a>
            </li>
        </ul>
    </div>
</div>
<div class="content">
    <div class="grid">
        <div class="grid-title">
            <div class="pull-left">Cài đặt hệ thống</div>
            <div class="pull-right">
                <a id="updatesetting" class="act_link" style="cursor: pointer">
                    Cập nhật cài đặt 
                </a>
                <script type="text/javascript">
                    $('#updatesetting').click(function() {
                        $.ajax({
                            url: $('#settings-form').attr('action'),
                            type: 'POST',
                            cache: false,
                            data: jQuery("#settings-form").serializeArray(),
                            success: function(data) {
                                alert(data);
                            },
                            error: function(data) {
                            },
                        });
                    });
                </script>
            </div>
            <div class="clear"></div>
        </div>
        <div class="grid-content">
            <?php
            echo CHtml::beginForm(Yii::app()->createUrl('/admin/st/update'), 'post', array(
                'id' => 'settings-form',
                'enctype' => 'multipart/form-data',
            ));
            ?>
            <div class="formRow">
                <?php echo CHtml::label('Tên công ty', 'company_name') ?>
                <div class="formRight">
                    <?php echo CHtml::textField('OpdSettings[company_name]', unserialize(OpdSettings::model()->find('`key`="company_name"')->value), array('size' => 200, 'maxlength' => 400)); ?>
                </div>
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Trụ sở', 'head_office') ?>
                <div class="formRight">
                    <?php echo CHtml::textField('OpdSettings[head_office]', unserialize(OpdSettings::model()->find('`key`="head_office"')->value), array('size' => 200, 'maxlength' => 400)); ?>
                </div>
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Văn phòng giao dịch', 'office_address') ?>
                <div class="formRight">
                    <?php echo CHtml::textField('OpdSettings[office_address]', unserialize(OpdSettings::model()->find('`key`="office_address"')->value), array('size' => 200, 'maxlength' => 400)); ?>
                </div>
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Số điện thoại', 'phone') ?>
                <div class="formRight">
                    <?php echo CHtml::textField('OpdSettings[phone]', unserialize(OpdSettings::model()->find('`key`="phone"')->value), array('size' => 200, 'maxlength' => 400)); ?>
                </div>
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Từ khóa', 'keywords') ?>
                <div class="formRight">
                    <?php echo CHtml::textField('OpdSettings[keywords]', unserialize(OpdSettings::model()->find('`key`="keywords"')->value), array('size' => 200, 'maxlength' => 400)); ?>
                </div>
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Email', 'email') ?>
                <div class="formRight">
                    <?php echo CHtml::textField('OpdSettings[email]', unserialize(OpdSettings::model()->find('`key`="email"')->value), array('size' => 200, 'maxlength' => 400)); ?>
                </div>
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Bản đồ', 'map') ?>
                <div class="formRight">
                    <?php echo CHtml::textField('OpdSettings[map]', unserialize(OpdSettings::model()->find('`key`="map"')->value)); ?>
                </div>
            </div>
            <div class="formRow">
                <?php
                $support_online = unserialize(OpdSettings::model()->find('`key`="support_online"')->value);
                $i = 0;
                ?>
                <label>Hỗ trợ trực tuyến:</label>
                <div class="formRight">
                    <?php foreach ($support_online as $item): ?>
                        <div id="support_<?= $i ?>" class="supportonline">
                            <?php echo CHtml::textField("Support[$i][uid]", $item['uid'], array('placeholder' => 'ID liên hệ')); ?>
                            <?php echo CHtml::textField("Support[$i][phone]",$item['phone'], array('placeholder' => 'Số điện thoại')); ?>
                            <?php
                            echo CHtml::dropDownList("Support[$i][type]", $item['yahoo'], array('yahoo' => 'Yahoo', 'skype' => 'Skype'));
                            ?>
                            <?php
                            echo CHtml::button('Thêm', array(
                                'class' => 'btn',
                                'style' => 'margin-top:-10px',
                            ));
                            ?>
                        </div>
                        <?php $i+=1; ?>
                    <?php endforeach; ?>

                </div>
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Banner quảng cáo chính',NULL);  ?>
                <div class="formRight">
                ssgsg
                </div>
                
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Banner khuyến mại',NULL);  ?>
                <div class="formRight">
                ssgsg
                </div>
                
            </div>
            <div class="formRow">
                <?php echo CHtml::label('Banner quảng cáo trang chủ',NULL);  ?>
                <div class="formRight">
                ssgsg
                </div>
                
            </div>


            <div class="formRow">
                <?php // echo CHtml::submitButton($model->isNewRecord ? 'Lưu' : 'Cập nhật');  ?>
            </div>

            <?php echo CHtml::endForm(); ?>
        </div>
    </div>
</div>


